package com.hellpro.lolbox.home.xiaosmein;

import android.content.Intent;
import android.support.v7.widget.Toolbar;
import android.view.KeyEvent;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.hellpro.lolbox.R;
import com.hellpro.lolbox.base.LolBaseActivity;

import butterknife.BindView;

public class XiaoShuoMeiNvWeb extends LolBaseActivity {


    @BindView(R.id.xiaoshuomeinv_toolbar)
    Toolbar xiaoshuomeinvToolbar;
    @BindView(R.id.xiaoshuomeinv_web)
    WebView xiaoshuomeinvWeb;
    private String path;

    @Override
    public int getLayoutId() {
        return R.layout.activity_xiao_shuo_mei_nv_web;
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode==KeyEvent.KEYCODE_BACK&&xiaoshuomeinvWeb.canGoBack()){
            xiaoshuomeinvWeb.goBack();
            return  true;
        }
        return super.onKeyDown(keyCode, event);

    }

    @Override
    public void initView() {
        Intent intent = getIntent();
        path = intent.getStringExtra("path");
 xiaoshuomeinvWeb.loadUrl(path);

        xiaoshuomeinvWeb.setWebViewClient(new WebViewClient(){
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return super.shouldOverrideUrlLoading(view, url);
            }
        });



    }


}
